const Express = require('express')
const SwaggerJsdoc = require('swagger-jsdoc')
const SwaggerUi = require('swagger-ui-express')
const Path = require('path')


let api_router = Express.Router()

//----------------- doc ----------------------///
api_router.use('/docs', 
    SwaggerUi.serve, 
    SwaggerUi.setup(SwaggerJsdoc({
        definition: {
            openapi: '3.0.0',     //版本号
            info: {
              title: 'Service API',
              version: '0.0.1',       //api版本
              description: 'API接口doc'
            }
          },
          apis: [Path.join(__dirname, '/v2', '*')]
    })))

//------------------ v1 ----------------------///
let v1 = require('./v1/api')
api_router.use('/v1', v1.router())

//----------------- v2 ----------------------///
let v2 = require("./v2/api")
api_router.use('/v2', v2.router())

module.exports = api_router